<?php
session_start();
require_once("../config/include_tokyo.inc.php");


//访问权限验证
$userRole = $_SESSION['user_role'];

if($userRole == 1){
	//管理员
}else{
	if($userRole > 0){
		$url = "../index.php?loginError=2";//没权限
	}else{
		$url = "../index.php?loginError=3";//没登录
	}	
	echo "<script language='javascript' type='text/javascript'>";
	echo "window.location.href='$url'";
	echo "</script>";
}




$type_id = $_POST["type_id"];
if($type_id == ""){
	$type_id = 1;
}

if($type_id == "0"){
	$sql_select = "select * from factoryproducts  order by type_id asc, order_id asc";
}else{
	$sql_select = "select * from factoryproducts where type_id=".$type_id." order by order_id asc";
}

$result = $db->Execute($sql_select);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<!--Begin:head-->
<? $pageTitle = "货源列表"; ?>
<?php include("../head.php"); ?>
<!--End:head-->


<body>
<?php include("../topMenu.php"); ?>


<form name="listForm" action="../factory/factoryList.php" method="post">
<br>
<div id="container" >	



<div>
<a href="javascript:toList('0')">全部</a>
<a href="javascript:toList('1')">绿光笔</a>
<a href="javascript:toList('2')">蓝光笔</a>
<a href="javascript:toList('3')">红光笔</a>
<a href="javascript:toList('4')">模组管子</a>
<a href="javascript:toList('5')">激光其他</a>
<a href="javascript:toList('6')">显微镜</a>
<a href="javascript:toList('7')">相机</a>
<a href="javascript:toList('8')">办公</a>
<a href="/factory/factoryOther.php">其他</a>
<a href="/factory/addressList.php">工厂联系</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="/factory/productInput.php">新加产品</a>
<a href="/factory/addressInput.php">新加工厂</a>
<br><br>
</div>

<div class="grayTable">	
<table>
<thead>
	<tr>
		<th scope="col" nowrap >排序ID</th>
		<th scope="col" nowrap>图片</th>
		<th scope="col" nowrap >厂家</th>
		<th scope="col" nowrap>波长(nm)</th>
		<th scope="col" nowrap>功率(mw)</th>
		<th scope="col" nowrap>价格</th>
		<th scope="col" >备注</th>
	</tr>
</thead>
<tbody>	
	<?php	
	if(empty($result) || $result->RecordCount() < 1){
		echo "<tr><td colspan=7 align='center'>记录为空.</td></tr>";
	}else{
		while (!$result->EOF) {				
			$strTR = "<tr>";
			$strTR = $strTR."<td nowrap><a href='productInput.php?id=".$result->fields['id']."'>".$result->fields['order_id']."</a></td>";
			$strTR = $strTR."<td nowrap><a href='images/".$result->fields['image_name']."' target='_blank'><img src='images/".$result->fields['image_name']."' width=30></a></td>";
			$strTR = $strTR."<td nowrap>".$result->fields['factory_name']."</td>";
			$strTR = $strTR."<td nowrap>".$result->fields['wavelength']."nm</td>";
			$strTR = $strTR."<td nowrap>".$result->fields['power']."mw</td>";
			$strTR = $strTR."<td nowrap>￥".$result->fields['price']."</td>";
			$strTR = $strTR."<td>".$result->fields['note']."</td>";
			$strTR = $strTR."</tr>";
			echo $strTR;
			$result->MoveNext();
		}
	}
	?>
</tbody>
</table>	
</div>
</div><!--end container -->
<br><br><br><br><br><br>

<input type="hidden" name="type_id" id="type_id" value="">
</form>
</body>




</html>

<script>
function toList(typeId){
	document.getElementById('type_id').value = typeId;
	document.listForm.submit();	
}


</script>

